<?php
class UserModel extends Model {
	/*
	 * 用户添加表单验证
	 */
	protected $_validate=array(
	array('username','require','用户账号必须填写！',0,'',3),
	array('username','','用户账号已经存在！',0,'unique',3),
	array('password','require','密码必须填写！',0,'',3),
	array('password','checkpasswordLen','密码长度不足6位！',0,'callback',3),
	array('email','email','邮箱格式不正确！',0,'',3),
	array('active',array(0,1),'数据错误！',0,'in',3),
	);

	function checkpasswordLen(){
		$password = $_POST["password"];
		dump($password);
		if (strlen($password) >= 6){
			return true;
		}else {
			return false;
		}
	}



	protected $_auto = array(
	array('reg_date','getDate',1,'callback'),
	array('password','md5',1,'function'),
	);

	function getDate(){
		return date('Y-m-d H:m:s');
	}
}